import React, { Component } from 'react'
import { withRouter } from 'react-router-dom';

class Header extends Component {
    back=()=>{
        this.props.history.goBack();
    }
    go=()=>{
        this.props.history.goForward();
    }
    render() {
        console.log(this.props);
        return (
            <div>
                <div className="row">
                    <div className="col-xs-offset-2 col-xs-8">
                        <div className="page-header">
                            <h2>Router Demo</h2>
                            <div>
                                <button onClick={()=>this.back()}>返回</button>
                                <button onClick={()=>this.go()}>前进</button>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        )
    }
}

export default withRouter(Header);